//条件集合
function OS_Condition_Group(host,active,node)
{
	this.$super=OS_Condition;
	this.$super(host,active,node);
	delete this.$super;
	
	var conditionList=[];
	var type="and";
	if (!!node.getAttribute("type")) type=node.getAttribute("type");
	
	for (var i=0;i<node.childNodes.length;i++)
	{
		if (node.childNodes[i].nodeType!=1)
		{
			continue;
		}
		var conditionNode=node.childNodes[i];
		var condition=OS_Condition.getInstance(host,active,conditionNode);
		if (!!condition) conditionList.push(condition);
	}
	
	this.check=function()
	{
		var res=true;
		for (var i=0;i<conditionList.length;i++)
		{
			switch(type)
			{
				case "and":res=res&&conditionList[i].check();break;
				case "or":res=res||conditionList[i].check();break;
				case "xor":res=res^conditionList[i].check();break;
			}
		}
		return res;
	}
}
OS_Condition.list.put("conditionGroup",OS_Condition_Group);

//等于
function OS_Condition_EQ(host,active,node)
{
	this.$super=OS_Condition;
	this.$super(host,active,node);
	delete this.$super;
	
	var key=node.getAttribute("key");
	var value=node.getAttribute("value");
	
	this.check=function()
	{
		var thev=host.status.V.get(key);
		if (thev==null) thev="null";
		if (thev==value) return true;
		else return false;
	}
}
OS_Condition.list.put("eqCondition",OS_Condition_EQ);


//不等于
function OS_Condition_NEQ(host,active,node)
{
	this.$super=OS_Condition;
	this.$super(host,active,node);
	delete this.$super;
	
	var key=node.getAttribute("key");
	var value=node.getAttribute("value");
	
	this.check=function()
	{
		var thev=host.status.V.get(key);
		if (thev!=value) return true;
		else return false;
	}
}
OS_Condition.list.put("neqCondition",OS_Condition_NEQ);


//大于
function OS_Condition_GT(host,active,node)
{
	this.$super=OS_Condition;
	this.$super(host,active,node);
	delete this.$super;
	
	var key=node.getAttribute("key");
	var value=node.getAttribute("value");
	
	this.check=function()
	{
		var thev=host.status.V.get(key);
		if (thev>value) return true;
		else return false;
	}
}
OS_Condition.list.put("gtCondition",OS_Condition_GT);


//大于等于
function OS_Condition_EGT(host,active,node)
{
	this.$super=OS_Condition;
	this.$super(host,active,node);
	delete this.$super;
	
	var key=node.getAttribute("key");
	var value=node.getAttribute("value");
	
	this.check=function()
	{
		var thev=host.status.V.get(key);
		if (thev>=value) return true;
		else return false;
	}
}
OS_Condition.list.put("egtCondition",OS_Condition_EGT);


//小于
function OS_Condition_LT(host,active,node)
{
	this.$super=OS_Condition;
	this.$super(host,active,node);
	delete this.$super;
	
	var key=node.getAttribute("key");
	var value=node.getAttribute("value");
	
	this.check=function()
	{
		var thev=host.status.V.get(key);
		if (thev<value) return true;
		else return false;
	}
}
OS_Condition.list.put("ltCondition",OS_Condition_LT);


//小于等于
function OS_Condition_ELT(host,active,node)
{
	this.$super=OS_Condition;
	this.$super(host,active,node);
	delete this.$super;
	
	var key=node.getAttribute("key");
	var value=node.getAttribute("value");
	
	this.check=function()
	{
		var thev=host.status.V.get(key);
		if (thev<=value) return true;
		else return false;
	}
}
OS_Condition.list.put("eltCondition",OS_Condition_ELT);
